/*  1:   */package com.linkage.bss.commons.util;
/*  2:   */
/* 11:   */public class RC4EncryptUtil
/* 12:   */{
/* 13:   */  public static String HloveyRC4(String aInput, String aKey)
/* 14:   */  {
/* 15:15 */    int[] iS = new int[256];
/* 16:16 */    byte[] iK = new byte[256];
/* 17:   */    
/* 18:18 */    for (int i = 0; i < 256; i++) {
/* 19:19 */      iS[i] = i;
/* 20:   */    }
/* 21:21 */    int j = 1;
/* 22:   */    
/* 23:23 */    for (short i = 0; i < 256; i = (short)(i + 1)) {
/* 24:24 */      iK[i] = ((byte)aKey.charAt(i % aKey.length()));
/* 25:   */    }
/* 26:   */    
/* 27:27 */    j = 0;
/* 28:   */    
/* 29:29 */    for (int i = 0; i < 255; i++) {
/* 30:30 */      j = (j + iS[i] + iK[i]) % 256;
/* 31:31 */      int temp = iS[i];
/* 32:32 */      iS[i] = iS[j];
/* 33:33 */      iS[j] = temp;
/* 34:   */    }
/* 35:   */    
/* 36:36 */    int i = 0;
/* 37:37 */    j = 0;
/* 38:38 */    String rOutput = "";
/* 39:39 */    short iMask = 15;
/* 40:40 */    char[] iInputChar = aInput.toCharArray();
/* 41:41 */    char[] iOutputChar = new char[iInputChar.length];
/* 42:42 */    for (short x = 0; x < iInputChar.length; x = (short)(x + 1)) {
/* 43:43 */      i = (i + 1) % 256;
/* 44:44 */      j = (j + iS[i]) % 256;
/* 45:45 */      int temp = iS[i];
/* 46:46 */      iS[i] = iS[j];
/* 47:47 */      iS[j] = temp;
/* 48:48 */      int t = (iS[i] + iS[j] % 256) % 256;
/* 49:49 */      int iY = iS[t];
/* 50:50 */      char iCY = (char)iY;
/* 51:51 */      iOutputChar[x] = ((char)(iInputChar[x] ^ iCY));
/* 52:   */    }
/* 53:   */    
/* 54:54 */    return new String(iOutputChar);
/* 55:   */  }
/* 56:   */}


/* Location:           E:\workspace\sungl111\workspace_promotion\BizHallConfig\WebRoot\WEB-INF\lib\bss.commons-0.1.jar
 * Qualified Name:     com.linkage.bss.commons.util.RC4EncryptUtil
 * JD-Core Version:    0.7.0-SNAPSHOT-20130630
 */